home *** CD-ROM | disk | FTP | other *** search
- //MGITools.js
- // Copyright (c) 1999 MGI Software Corp. All Rights Reserved
- // <Script>
-
- function GetBrowserVersion ()
- {
- var ua = window.navigator.userAgent
- var msie = ua.indexOf ( "MSIE " )
-
- if ( msie > 0 ) // is Microsoft Internet Explorer; return version number
- return parseInt ( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) )
- else
- return 0 // is other browser
- }
-
- function CreateNewDocument ()
- {
- LoadHeadTemplate();
- SetInsertModeFull(); //SpencerP-test
- SelectLayer('0');
- DoDelete();
- SelectLayer('none');
- }
-
- function PrepareLayer (strLayerName)
- {
- SetReplacementLayer ('none') ;
-
- // make sure this layer is not locked
- LockLayer (strLayerName, 0) ;
-
- // make sure this layer is visible
- ShowLayer (strLayerName) ;
-
- SelectLayer (strLayerName) ; // Select the layer in question
- SetReplacementLayer (strLayerName) ; // Set the layer to accept replacement
- }
-
- function GetColorSwatchHTML ()
- {
- var strHTML = "" ;
-
- strHTML += "<OBJECT ID='MGIColorPopup' WIDTH=40 HEIGHT=40 VSPACE=10" ;
- strHTML += "< CLASSID='CLSID:205D3C20-FD5E-11D2-ACB6-0080C877D9B9'>" ;
- strHTML += "<PARAM NAME='WorkflowID' VALUE='file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf'>" ;
- strHTML += "<PARAM NAME='WorkflowStep' VALUE=0>" ;
- strHTML += "<PARAM NAME='DisplayWorkflowID' VALUE='file:/Resources/WorkflowsComponent|Common|stdgui.wkf'>" ;
- strHTML += "<PARAM NAME='DisplayStep' VALUE=62>";
- // strHTML = "<PARAM NAME='HelpFileName' VALUE='Prism.hlp'>" ;
- strHTML += "<PARAM NAME='BackgroundMoniker' VALUE='file:/Resources/Decor/Panel_Mkv.PNG'>>" ;
- strHTML += "</OBJECT>" ;
-
- return strHTML ;
- }
-
- function DoDelete()
- {
- LTKTriggerEvent("CommandDispatcher,Active,20036");
- }
-
- function DoClose()
- {
- LTKTriggerEvent('CommandDispatcher,Broadcast,20002');
- }
-
- function DoCloseAll()
- {
- LTKTriggerEvent('CommandDispatcher,Broadcast,20003');
- }
-
- function DoAbandonAndCloseAll()
- {
- LTKTriggerEvent('CommandDispatcher,Broadcast,20003');
- DoCloseAll();
- }
-
- /*
- * These are tools that (I know for a fact)work.
- */
-
- function SelectTrimTool (strMode)
- {
- switch (strMode)
- {
- default :
- case 'start' :
- LTKTriggerEvent ('CommandDispatcher,Active,5105') ; // IDC_SLD_SMARTPOLY
- LTKSetWorkflowValue ("file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf",18,0) ;
- break ;
-
- case '+' :
- // LTKTriggerEvent ('CommandDispatcher,Active,5001') ; // IDM_TOOL_FREEHAND
- LTKSetWorkflowValue ("file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf",18,1) ;
- break ;
-
- case '-' :
- // LTKTriggerEvent ('CommandDispatcher,Active,5001') ; // IDM_TOOL_FREEHAND
- LTKSetWorkflowValue ("file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf",18,2) ;
- break ;
- }
- }
-
- function GetOpacity ()
- {
- // Grab the opacity
- return LTKGetWorkflowValue ('file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf',31) ;
- }
-
- function SetOpacity (nOpacity)
- {
- // set the opacity
- LTKSetWorkflowValue ('file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf',31,nOpacity) ;
- }
-
- function SelectEraserTool ()
- {
- // Grab the current opacity
- var nOpacity = GetOpacity () ;
-
- // force the opacity to be 100
- SetOpacity (100) ;
-
- LTKTriggerEvent ('CommandDispatcher, Active, 5016') ; // IDM_TOOL_ERASER
-
- return nOpacity ;
- }
-
- function SelectBlurTool ()
- {
- LTKTriggerEvent ('CommandDispatcher, Active, 5001') ; // IDM_TOOL_FREEHAND
- LTKTriggerEvent ('file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf, 21, 606401') ; // IDM_SOFTENPAINT
- }
-
- function SelectPaintToolSolid ()
- {
- LTKTriggerEvent ('CommandDispatcher, Active, 5001') ; // IDM_TOOL_FREEHAND
- LTKTriggerEvent ('file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf, 21, 606001') ; // IDM_SOLIDPAINT
- }
-
- function SelectToningTool ()
- {
- LTKTriggerEvent ('CommandDispatcher, Active, 5001') ; // IDM_TOOL_FREEHAND
- LTKTriggerEvent ('file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf, 21, 606005') ; // IDM_TONINGPAINT
- }
-
- function SelectPenSize (strSize)
- {
- var strCommand = "CommandDispatcher, Active, 20052," + strSize + ",0" ; // IDM_EDIT_SETPENSIZE
-
- LTKTriggerEvent (strCommand) ;
- }
-
- function SelectColorPickerTool () // IDM_TOOL_EYEDROPPER
- {
- LTKTriggerEvent ('file:/Resources/WorkflowsComponent|Photos|EditorPaint.wkf, 21, 5007') ;
- // SetOpacity (10) ; // as per QA's request*2
- }
-
- function ResetWarpTool ()
- {
- LTKTriggerEvent ('CommandDispatcher, Active, 7200') ; // IDC_WARP_RESET
- }
-
- function SelectWarpTool ()
- {
- LTKTriggerEvent ('CommandDispatcher, Active, 20050') ; // IDM_EDIT_FORCEPREVIEW
- }
-
- function OpenSelectedItem ()
- {
- LTKTriggerEvent ('CommandDispatcher, Active, 20212') ; // IDM_OPENITEM
- LTKTriggerEvent ('CommandDispatcher, Active, 20200') ; // IDM_ADD
- }
-
- function RotateSelectedItem (strDirection)
- {
- switch (strDirection)
- {
- case 'ccw' :
- case 'left' :
- LTKTriggerEvent ('CommandDispatcher, Active, 45001') ; // IDM_IMAGE_ROTATECCLKW_INCREMENT
- break ;
-
- case 'cw' :
- case 'right' :
- LTKTriggerEvent ('CommandDispatcher, Active, 45000') ; // IDM_IMAGE_ROTATECLKW_INCREMENT
- break ;
-
- default :
- break ;
- }
- }
-
- function MoveSelectedItem (strDirection)
- {
- switch (strDirection)
- {
- case 'up' :
- LTKTriggerEvent ('CommandDispatcher, Active, 45006') ; // IDM_IMAGE_MOVEUP_INCREMENT
- break ;
-
- case 'down' :
- LTKTriggerEvent ('CommandDispatcher, Active, 45007') ; // IDM_IMAGE_MOVEDOWN_INCREMENT
- break ;
-
- case 'left' :
- LTKTriggerEvent ('CommandDispatcher, Active, 45005') ; // IDM_IMAGE_MOVELEFT_INCREMENT
- break ;
-
- case 'right' :
- LTKTriggerEvent ('CommandDispatcher, Active, 45004') ; // IDM_IMAGE_MOVERIGHT_INCREMENT
- break ;
-
- default :
- break ;
- }
- }
-
- function SelectZoomTool ()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,2101') ; // IDC_VWR_ZOOMMODE
- }
-
- function SelectPanningTool ()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,2102') ; // IDC_VWR_PANMODE
- }
-
- //SpencerP - 05/27/99
- function SelectAll ()
- {
- LTKTriggerEvent ('CommandDispatcher,Active,20038') ; // IDM_EDIT_SELECTALL
- }
-
- //SpencerP - 05/27/99
- function CutToClipboard ()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,20032') ; // IDM_EDIT_CUT
- }
-
- function CopyToClipboard ()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,20033') ; // IDM_EDIT_COPY
- }
-
- function PasteFromClipboard (bFlushClipboard)
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,20034') ; // IDM_EDIT_PASTE
-
- if (bFlushClipboard == true)
- FlushClipboard()
- }
-
- function ClipPaste() // Used by MakeoverBrowser.js and MakeoverDocView.js
- {
- LTKTriggerEvent( "CommandDispatcher,Active,20034");
- }
-
- function CopyAll () // copy entire image, even if nothing selected
- {
- LTKTriggerEvent( "CommandDispatcher,Active,20055") ; // IDM_EDIT_COPYALL
- }
-
- function InvertSelection()
- {
- LTKTriggerEvent( "CommandDispatcher,Active,20039");
- }
-
- function ClearSelection()
- {
- LTKTriggerEvent( "CommandDispatcher,Active,20040");
- }
-
- function CancelTrimTool ()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,20044') ; // IDM_EDIT_CANCEL
- }
-
- function ResetTrimTool ()
- {
- LTKTriggerEvent ('CommandDispatcher,Active,20045') ; // IDM_EDIT_RESETTRIM
- LTKTriggerEvent ('CommandDispatcher,Active,20044') ; // IDM_EDIT_CANCEL
- }
-
- function ResizeImage (strWidth, strHeight)
- {
- var strParam = 'CommandDispatcher,Active,20109' ;
-
- strParam += ',' + strWidth + ',' + strHeight ;
-
- LTKTriggerEvent (strParam) ; // IDM_IMAGE_RESIZE
- }
-
- function ScaleImage (strDirection)
- {
- switch (strDirection)
- {
- case 'up' :
- LTKTriggerEvent ('CommandDispatcher,Active,45003') ; // IDM_IMAGE_SCALEUP_INCREMENT
- break ;
-
- case 'down' :
- LTKTriggerEvent ('CommandDispatcher,Active,45002') ; // IDM_IMAGE_SCALEDOWN_INCREMENT
- break ;
-
- default :
- break ;
- }
- }
-
- function EnableLayoutPaintTool (bFlag)
- {
- if (bFlag)
- {
- // LTKTriggerEvent ('CommandDispatcher,Active,606401') ; // IDM_SOFTENPAINT
- LTKTriggerEvent ('CommandDispatcher,Active,5002') ; // IDM_EDITOR_FLOATSELECTION
- }
- else
- {
- }
- }
-
- function DisableImageEditorTools ()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,20044') ; // IDM_EDIT_CANCEL
- LTKTriggerEvent ('CommandDispatcher,Broadcast,5039') ; // IDM_EDITORNEUTRAL
- }
-
- function MoveLayer (nLayer, strPos)
- {
- switch (strPos)
- {
- case 'front' :
- LTKTriggerEvent ('CommandDispatcher, Active, 20104') ; // IDM_IMAGE_TOFRONT
- break ;
-
- case 'back' :
- LTKTriggerEvent ('CommandDispatcher, Active, 20105') ; // IDM_IMAGE_TOBACK
- break ;
-
- default :
- break ;
- }
- }
-
- //spencerp 05/27/99
- function SelectLayer ( layer )
- {
- switch ( layer )
- {
- case 'none':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,0') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'grid':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVGrid') ; // IDM_LAYOUT_SETSELECTION
- break ;
- case 'background':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVBackground') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'face':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVFace') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'hair':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVHair') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'eyeglasses':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVEyeglasses');
- break;
- case 'hat':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVHat');
- break;
- case 'frame':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVFrame');
- break;
- case 'temp1':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVTemp1');
- break;
- case 'temp2':
- LTKTriggerEvent ('CommandDispatcher,Active,45100,1024,STR MKVTemp2');
- break;
- default:
- LTKTriggerEvent ('CommandDispatcher,Active,45100,'+ layer ) ; // IDM_LAYOUT_SETSELECTION
- break;
- }
- }
-
- //spencerp 05/27/99
- function SetReplacementLayer( layer )
- {
- switch ( layer )
- {
- case 'none':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,0') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'background':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVBackground') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'face':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVFace') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'hair':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVHair') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'eyeglasses':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVEyeglasses') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'hat':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVHat') ; // IDM_LAYOUT_SETSELECTION
- break;
- case 'frame':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVFrame');
- break;
- case 'temp1':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVTemp1');
- break;
- case 'temp2':
- LTKTriggerEvent ('CommandDispatcher,Active,45301,1024,STR MKVTemp2');
- break;
- }
- }
-
- //spencerp 06/01/99
- function LockLayer ( layer, lock )
- {
- var commandID;
-
- if ( lock == '1' )
- commandID = '45200'; // IDM_LAYOUT_LOCKLAYER
- else
- commandID = '45201'; // IDM_LAYOUT_UNLOCKLAYER
-
- switch ( layer )
- {
- default:
- case 'none':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',1,MKVNone') ;
- break;
- case 'background':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVBackground') ;
- break;
- case 'face':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVFace') ;
- break;
- case 'hair':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVHair') ;
- break;
- case 'eyeglasses':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVEyeglasses') ;
- break;
- case 'hat':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVHat') ;
- break;
- case 'frame':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVFrame') ;
- break;
- case 'temp1':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVTemp1') ;
- break;
- case 'temp2':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVTemp2') ;
- break;
- }
- }
-
- //spencerp 06/01/99
- function SendLayerToImageEditor()
- {
- LTKTriggerEvent ('CommandDispatcher,Active,7026') ; // IDM_PUBLISH_IMAGEEDIT
- }
-
- //spencerp 05/27/99
- function LoadHeadTemplate()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,45400,0,STR file:/Temp/Untitled.pzp') ;
- }
-
- //spencerp 05/27/99
- function TurnOnSelectionHandle( bFlag )
- {
- state = !bFlag ? '0' : '1' ;
- LTKTriggerEvent ('CommandDispatcher,Active,45300,' + state) ; // IDM_SETUSEHANDLES
- }
-
- function DoUndo ()
- {
- LTKTriggerEvent ('CommandDispatcher,Active,20030') ; // IDM_EDIT_UNDO
- }
-
- function DoRedo ()
- {
- LTKTriggerEvent ('CommandDispatcher,Active,20031') ; // IDM_EDIT_REDO
- }
-
- function SetDragNDropPosOveride( val )
- {
- if ( val == 1 )
- LTKTriggerEvent ('CommandDispatcher,Active,45140,1') ; // IDM_LAYOUT_OVERRIDEDROPPOS
- else
- LTKTriggerEvent ('CommandDispatcher,Active,45140,0') ; // IDM_LAYOUT_OVERRIDEDROPPOS
- }
-
- function SetInsertModeFull()
- {
- LTKTriggerEvent ('CommandDispatcher,Active,45150,1,2') ; // IDM_LAYOUT_SETINSERTXPOS
- LTKTriggerEvent ('CommandDispatcher,Active,45151,1,2') ; // IDM_LAYOUT_SETINSERTYPOS
- LTKTriggerEvent ('CommandDispatcher,Active,45160,1,1') ; // IDM_LAYOUT_SETINSERTXSCALE
- LTKTriggerEvent ('CommandDispatcher,Active,45161,1,1') ; // IDM_LAYOUT_SETINSERTYSCALE
- }
-
- //spencerp 07/05/99
- function FlushClipboard()
- {
- LTKTriggerEvent ('CommandDispatcher,Broadcast,45401,0,0') ; // IDM_FLUSH_CLIPBOARD
- }
-
- //spencerp 08/27/99
- function DeleteWithTransparent ( bFlag )
- {
- if ( bFlag == '0' )
- LTKTriggerEvent ('CommandDispatcher,Active,45320,0,0') ;
- else
- LTKTriggerEvent ('CommandDispatcher,Active,45320,0,STR file:/Resources/CoreUI|Transparent.png') ; // IDM_LAYOUT_SETDELETEMONIKER
- }
-
- function ReplaceLayerImage (strToColor)
- {
- var strTemp = 'CommandDispatcher,Active,45390,1024,STR MKVHair<'+ strToColor ;
- LTKTriggerEvent (strTemp) ;
- }
-
- function ShowLayer (strLayer)
- {
- HideLayer (strLayer, false) ;
- }
-
- function HideLayer (strLayer, bHide)
- {
- var commandID;
-
- if (bHide == true)
- commandID = '45202'; // IDM_LAYOUT_HIDELAYER
- else
- commandID = '45203'; // IDM_LAYOUT_SHOWLAYER
-
- switch (strLayer)
- {
- default:
- case 'all':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',1,MKVNone') ;
- break;
-
- case 'background':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVBackground') ;
- break;
-
- case 'face':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVFace') ;
- break;
-
- case 'hair':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVHair') ;
- break;
-
- case 'eyeglasses':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVEyeglasses') ;
- break;
-
- case 'hat':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVHat') ;
- break;
-
- case 'frame':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVFrame') ;
- break;
-
- case 'temp1':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVTemp1') ;
- break;
-
- case 'temp2':
- LTKTriggerEvent ('CommandDispatcher,Active,'+ commandID + ',0,STR MKVTemp2') ;
- break;
- }
- }
-
- //SpencerP
- function DoAboutBox ()
- {
- // LTKTriggerEvent("CommandDispatcher,Broadcast,20147,0");
- showModalDialog("./About/About.html", null, "dialogWidth:350px;dialogHeight:600px;help:no");
- }